<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="Bookmark" href="/favicon.ico">
	<link rel="Shortcut Icon" href="/favicon.ico" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="__UU__/lib/lib/html5.js"></script>
	<script type="text/javascript" src="__UU__/lib/lib/respond.min.js"></script>
	<script type="text/javascript" src="__UU__/lib/lib/PIE_IE678.js"></script>
	<![endif]-->
	<link href="__UU__/css/H-ui.min.css" rel="stylesheet" type="text/css" />
	<link href="__UU__/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
	<link href="__UU__/lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
	<link href="__UU__/css/style.css" rel="stylesheet" type="text/css" />
	<!--[if IE 6]>
	<script type="text/javascript" src="__UU__/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>活动列表</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 
		首页 <span class="c-gray en">&gt;</span> 
		验证 <span class="c-gray en">&gt;</span> 
		验票 
		<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
			<i class="Hui-iconfont">&#xe68f;</i>
		</a>
	</nav>
	<div class="pd-20">
		<!--<div class="Huialert Huialert-success">
			<i class="Hui-iconfont">&#xe6e0;</i> 注意：活动开始前的2个小时才能验证
			
			<button class="btn btn-success radius" type="button" onclick="layer_show('选择活动','../reuse/list.html')" >请选择活动</button>
		</div>-->
		<div class="mt-20">
			<div class="panel panel-warning" id="pan">
				<div class="panel-header">验票</div>
				<div class="panel-body">
					<!--<table class="table table-border table-bordered table-bg table-sort search-table">
						<thead>
							<tr class="text-c">
								<th>活动名称</th>
								<th>活动类型</th>
								<th>费用类型</th>
								<th>参加人数</th>
								<th>发布时间</th>
							</tr>
						</thead>
						<tbody>
							
						</tbody>
					</table>-->
					
					<div class="mt-20 " style="overflow: hidden;">
						<div class="row">
							<div class="col-8 col-offset-2">
							    <label class="form-label col-2">
							        <span class="c-red" style="font-size:14px">请输入用户提供8位票号进行验票</span>
							    </label>
							    <div class="col-5">
								   <input type="text" name="" id="inputs" class="input-text tang-text" placeholder="请输入票号后回车" maxlength="8" />
								</div>
								<div id="loaddd">正在查询...</div>
								<div class="piao-detail" style="display: none">
									<h3 class="piao-status success">可验票</h3>
									<!-- <h3 class="piao-status past">已过期</h3>
									<h3 class="piao-status red">已验票</h3> -->
									<table class="table table-border">
										<tbody>
											<tr>
												<td>票号</td>
												<td>12345678</td>
												<td>票名</td>
												<td>VIP票</td>
											</tr>
											<tr>
												<td>活动</td>
												<td>扒拉扒拉下午茶</td>
												<td>场次</td>
												<td>第一场</td>
											</tr>
											<tr>
												<td>购票人</td>
												<td>13699772411 / jack</td>
												<td>退票时间</td>
												<td>2014-07-15 15:30:25</td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>

					<div class="text-c mt-20">
						<button type="button" class="btn btn-danger radius" id="enter">确定</button>
					</div>
					
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript" src="__UU__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__UU__/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="__UU__/js/H-ui.js"></script>
<script type="text/javascript" src="__UU__/js/H-ui.admin.js"></script>
<script type="text/javascript">
//	var activity_id;
//	function activity (shtml, aid){
//		if( $.trim(shtml) == "" || !aid ){
//			return ;
//		}
//		activity_id = aid;
//		var pan = $('#pan');
//		if( pan.is(':visible') ){
//			$('.search-table tbody').empty();
//		}
//		$('.search-table tbody').append(shtml);
//		pan.show();
//	}
	

	var jilu = 1 , piaohao = "";

	function checkPiao (){
		if( jilu === 1 ) {
			// jilu == 1 查票 
			var v = $('#inputs');
			if( $.trim(v.val()) === "" ){
				layer.msg('请输入票号');
				return ;
			}
			//票号：8位数字！！
			var reg = /^\d{8}$/g;
			if( reg.test( v.val() ) ){
				//验号正确，AJAX
	//			$.ajax()  后处理
	            var loaddd = $('#loaddd'),
					detail = $('.piao-detail');
	            loaddd.show();
	            $.ajax({
	            	url:"__APP__/Check/checkcode",
	            	type:"post",
	            	data:{"code":v.val(),"type":1},
	            	dataType:"json",
	            	success:function(e){
	            		if(e.code == "200"){
	            			detail.show().empty().html(e.url);
	            			$('#inputs').prop('disabled',true);
        					piaohao = v;
        					++jilu;
        					loaddd.hide();
        					detail.show();
        					$('#enter').focus();
        					$('#inputs').blur();
	            		}else{
	            			$('#inputs').focus();
	            			loaddd.hide();
	            			layer.msg(e.msg);
	            		}
	            	},error:function(){
	            		layer.msg("网络错误");
	            	}
	            })  
				// 模拟AJAX  1.5 秒后成功
				
				
				
			}else{
				layer.msg("票号不正确");
				$('#inputs').focus();
				return ;
			}
		}else{
			--jilu;
			//  否则 验票
			var v = $('#inputs');
			var loaddd = $('#loaddd'),
				detail = $('.piao-detail');
			detail.hide();
			piaohao = '';
			// ajax
			 $.ajax({
	            	url:"__APP__/Check/checkcode",
	            	type:"post",
	            	data:{"code":v.val(),"type":2},
	            	dataType:"json",
	            	success:function(e){
	            		if(e.code == "200"){
	            			$('#inputs').prop('disabled',false);
	            			layer.msg("验票成功");
	            			setTimeout(function() {
	            				$('#inputs').val("").focus();
	            			},500)
	            		}else{
	            			$('#inputs').focus();
	            			loaddd.hide();
	            			layer.msg(e.msg);
	            		}
	            	},error:function(){
	            		layer.msg("网络错误");
	            	}
	            })  
		}
	}
	$('#enter').click(function(evt) {
		evt.stopPropagation();
		checkPiao();
		return false;
	});
	$('#inputs').keyup(function (evt){
		evt.stopPropagation();
		var keys = evt.which;
		if( keys === 13 ){
			checkPiao();
		}
		return false;
	});
	
	
	
</script>
</body>
</html>
